package Server_Netty.TCP;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class TCPBytesDataProtocolEncoder extends MessageToByteEncoder<TCPBytesDataProtocol> {
    @Override
    protected void encode(ChannelHandlerContext ctx, TCPBytesDataProtocol msg, ByteBuf byteBuf) throws Exception {
        //写入CPBytesDataProtocol具体内容
        byteBuf.writeShort(msg.get_Data_Len_Short());
        byteBuf.writeBytes(msg.getContent());
    }
}
